package com.cn.wanxi.model;

import java.util.ArrayList;
import java.util.List;

/**
 * 新闻版块
 */
public class NewsSectionModel {
    private int id;
    private String name;

    private int[] ids = {1, 2, 3};
    private String[] names = {"行业动态", "公司新闻", "餐饮知识"};
    private List<NewsSectionModel> list = new ArrayList<>();

    /**
     * 得到新闻版块list
     *
     * @return
     */
    public List<NewsSectionModel> getList() {
//        for (int i : ids) {
//    增强for循环 jdk1.5版本之后才出现的
//        }
        for (int i = 0; i < ids.length; i++) {
            NewsSectionModel model = new NewsSectionModel();
            model.setId(ids[i]);
            model.setName(names[i]);
            list.add(model);
        }
        return list;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
